package hr.ctg.domain.model;

// Generated 2007.05.02 22:50:59 by Hibernate Tools 3.2.0.b9

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.NotNull;

/**
 * EmailAdresa generated by hbm2java
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "email_adresa")
@NamedQueries( { @NamedQuery(name = "EmailAdresa.findByIdObjekta", query = "select a from EmailAdresa a where a.objekt.idObjekta = ?") })
public class EmailAdresa implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2793296991606739614L;
	private int idEmailAdrese;
	private Objekt objekt;
	private TipEmailAdrese tipEmailAdrese;
	private String email;

	public EmailAdresa() {
	}

	public EmailAdresa(final int idEmailAdrese, final Objekt objekt,
			final TipEmailAdrese tipEmailAdrese, final String email) {
		this.idEmailAdrese = idEmailAdrese;
		this.objekt = objekt;
		this.tipEmailAdrese = tipEmailAdrese;
		this.email = email;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_email_adrese", unique = true, nullable = false)
	@NotNull
	public int getIdEmailAdrese() {
		return idEmailAdrese;
	}

	public void setIdEmailAdrese(final int idEmailAdrese) {
		this.idEmailAdrese = idEmailAdrese;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_objekta", nullable = false)
	@NotNull
	public Objekt getObjekt() {
		return objekt;
	}

	public void setObjekt(final Objekt objekt) {
		this.objekt = objekt;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_tipa_email_adrese", nullable = false)
	@NotNull
	public TipEmailAdrese getTipEmailAdrese() {
		return tipEmailAdrese;
	}

	public void setTipEmailAdrese(final TipEmailAdrese tipEmailAdrese) {
		this.tipEmailAdrese = tipEmailAdrese;
	}

	@Column(name = "email", nullable = false)
	@NotNull
	public String getEmail() {
		return email;
	}

	public void setEmail(final String email) {
		this.email = email;
	}

}
